package jmine.tec.web.wicket.component.report;

import jmine.tec.report.impl.table.CellValueResolver;

/**
 * Implementação base de {@link ComponentValueResolver}.
 * 
 * @author Rafael Volpato
 * @date Dec 28, 2011
 * @param <V> tipo do objeto
 */
public abstract class AbstractComponentValueResolver<V> implements ComponentValueResolver<V> {

    private CellValueResolver<V> delegate;

    /**
     * Construtor.
     */
    public AbstractComponentValueResolver() {
        this(null);
    }

    /**
     * Construtor.
     * 
     * @param delegate delegate
     */
    public AbstractComponentValueResolver(CellValueResolver<V> delegate) {
        this.delegate = delegate;
    }

    /**
     * {@inheritDoc}
     */
    public final Object resolveCellValue(V rowValue) {
        if (this.delegate != null) {
            return this.delegate.resolveCellValue(rowValue);
        } else {
            return null;
        }
    }
}
